package cn.school.controller.dashboard;

import cn.school.common.api.CommonResult;
import cn.school.dashboard.service.CampusDashBoardService;
import cn.school.dashboard.vo.*;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @className: CampusDashBoardController
 * @author: Alex
 * @date: 2023/4/18
 **/
@RestController
@RequestMapping("/campus/dashboard")
public class CampusDashBoardController {
	@Autowired
	private CampusDashBoardService campusDashBoardService;
	// 近一年 新增学生情况 与去年比较
	@ApiOperation("获取新增学生情况统计数据")
	@GetMapping("/getAddedStudentList")
	public CommonResult<List<AddedStudentVo>> getAddedStudentList() {
		List<AddedStudentVo> resultList = campusDashBoardService.getAddedStudentList();
		return CommonResult.success(resultList);
	}
	
	// 全时间段老师请假类型分类
	@ApiOperation("获取老师请假类型统计数据")
	@GetMapping("/getTeacherLeaveList")
	public CommonResult<List<TeacherLeaveVo>> getTeacherLeaveList() {
		List<TeacherLeaveVo> teacherLeaveList = campusDashBoardService.getTeacherLeaveList();
		return CommonResult.success(teacherLeaveList);
	}
	
	// 全时间段通知类型分类
	@ApiOperation("获取所有通知统计数据")
	@GetMapping("/getNoticeList")
	public CommonResult<List<NoticeTypeBoard>> getSchoolNoticeList() {
		List<NoticeTypeBoard> schoolNoticeList = campusDashBoardService.getSchoolNoticeList();
		return CommonResult.success(schoolNoticeList);
	}
	
	// 全时间段班级学生数量
	@ApiOperation("获取班级学生数量统计数据")
	@GetMapping("/getClassStudentCount")
	public CommonResult<List<Map<String, String>>> getClassStudentCount() {
		List<Map<String, String>> resultList = campusDashBoardService.getClassStudentList();
		return CommonResult.success(resultList);
	}
	
	// 班级请假排名  全年 本月 当天
	@ApiOperation("获取班级请假排名统计数据")
	@GetMapping("/getClassLeaveRanking")
	public CommonResult<List<ClassLeaveRankVo>> getClassLeaveRanking() {
		List<ClassLeaveRankVo> leaveRanking = campusDashBoardService.getClassLeaveRanking();
		return CommonResult.success(leaveRanking);
	}
	
	// 全国学校分布 假数据填充
	@ApiOperation("获取学校分布统计数据")
	@GetMapping("/getSchoolDistribution")
	public CommonResult<List<SchoolPositionVo>> getSchoolDistribution() {
		List<SchoolPositionVo> resultList = campusDashBoardService.getSchoolDistribution();
		return CommonResult.success(resultList);
	}
}
